# 装饰器
from flask import g, redirect, url_for, render_template
from functools import wraps


# def login_required_user(func):
#     @wraps(func)  # 此函数必须写
#     def wrapper(*args, **kwargs):
#         if g.user is None:  # 未登录重定向到系统主界面
#
#             return render_template("index.html")
#         else:
#
#             if g.user.type=="student" :
#                 return func(*args, **kwargs)
#             else:
#                 return redirect(url_for("base.index"))
#
#     return wrapper


# def login_required_Admin(func):
#     @wraps(func)  # 此函数必须写
#     def wrapper(*args, **kwargs):
#         if g.user is None:  # 未登录重定向到系统主界面
#             return render_template("index.html")
#         else:
#             return func(*args, **kwargs)
#
#     return wrapper
